Recently need to network transfer large files, so the socket-based file transfer made a preliminary understanding. On the basis of a user-provided program, I have done some processing, using buffered input/output stream to package the output stream, and then use the data input/output stream for packaging, speed up the transmission. Talk less, first look at the server-side program.1. Server-sidePackageLocalsocket;importJava.io.bufferedinputstream;importJava.io.datainputstream;importJava.io.dataou
The recent need for network transmission of large files, so the socket based on the file transfer made a preliminary understanding. On the basis of a user-provided program, I made some processing, using a buffer input/output flow to wrap the output stream, and then using data input/output flow packaging, speed of transmission. Less nonsense, first look at the server-side program.
1. Server-side
Package sterning;
Import Java.io.BufferedInputStream;
Import Java.io.DataInputStream;
Import Jav
After finding a Java Socket Image Transmission example on the Internet for a long time, you can directly use
It will be useful in the future.
Server:
Java code:
Import java. Io. bufferedinputstream;Import java. Io. datainputstream;Import java. Io. dataoutputstream;Import java. Io. file;Import java. Io. fileinputstream;Import java.net. serversocket;Import java.net. Socket;
Public class servertest {Int Port = 8821;
Void start (){Socket S = NULL;Try {Se
The Java 5 executorservice is used to implement multi-threading in the thread pool mode, simulating that multiple users on the client send requests to the same server.
1. Server
Package sterning;
Import java. Io. bufferedreader;Import java. Io. ioexception;Import java. Io. inputstream;Import java. Io. inputstreamreader;Import java. Io. outputstream;Import java. Io. printwriter;Import java.net .*;Import java. util. Concurrent .*;
Public class multithreadserver {Private int Port =
This article describes the Java socket based file transfer implementation method. Share to everyone for your reference, specific as follows:
1. The Java code is as follows:
Package sterning;
Import Java.io.BufferedInputStream;
Import Java.io.DataInputStream;
Import Java.io.DataOutputStream;
Import Java.io.File;
Import Java.io.FileInputStream;
Import Java.net.ServerSocket;
Import Java.net.Socket;
public class Servertest {int port = 8821;
void
the item as the contents of the file, if you need to set up CLIENTCHARSET=GBK, create a named " Clientcharset "is a file that contains" GBK ".About the basic parameter configuration:
Clientcharset = GBK #必设 to prevent Windows logon from appearing garbled in Chinese
Dontresolve = Yes #不解析域名, you can save login time
brokenclientscompatibility = Yes #兼容IE等非标准FTP client
Chrooteveryone = Yes #把所有用户限制在其homedir下
Keepallfiles = Yes #禁止用户删除文件, except in the Trustedgid group
Trust
1. ServerImport Java.io.bufferedreader;import Java.io.ioexception;import Java.io.inputstream;import Java.io.inputstreamreader;import Java.io.outputstream;import Java.io.printwriter;import Java.net.*;import java.util.concurrent.*;p Ublic class Multithreadserver {private int port = 8821;private ServerSocket serversocket; Private Executorservice executorservice;//thread pool private final int pool_size = 10;//Single CPU thread pool size public multithrea
Recently I've been looking at jquery source, (Code analysis, document analysis, video analysis) and then I'll summarize it. The following is the source code analysis for the JQuery-2.0.3 version:
Jquery-2.0.3.js Download One, JQ overall code (update ...)
1. JQuery: The overall architecture2.21-94 lines: Some variables and functions are defined3.96-283 lines: Add some methods and properties to the JQ object4.285-347 lines: Extend JQ inheritance method5.349-817 lines: jquery.extend () extend so
defined by the AOP Federation for surround enhancement, i.e., weaving enhanced logic downloads before and after method executionProxy Component Class diagram650) this.width=650; "height=" 544 "width=" 525 "src=" http://dl2.iteye.com/upload/attachment/0119/8821/ 75aaa516-ca23-30ca-b313-1ff1defa65ec.jpg "style=" border:0px; "/>In spring, when the container is initialized, scanning to the slice class takes the proxy object through Proxyfactory's GetProx
Server-side: Public class Server { Private intport=8821;PrivateServerSocket ServerSocket;PrivateExecutorservice Executorservice;//thread pool Private Final intPool_size=Ten;//Single CPU thread pool size Public Multithreadserver()throwsioexception{serversocket=NewServerSocket (port);the//runtime availableprocessor () method returns the number of CPUs for the current system.Executorservice=executors.newfixedthreadpool (Runtime.getruntime ().
If the header file is not provided, COM is used in C ++.
When testing com with CPP, use the _ I. C and *. H files generated by midl. This article demonstrates using the com method with CPP without these files.
The test project must be an MFC project (the process of creating an MFC project is omitted ).
1. Add the typelib class:
2. Add the test code:
Void cmfcclientdlg: onbnclickedok () {cfirstcoclx t; IID; // CLSID can be obtained from *. for more information, see msdn index-# impor
Samba mount. cifs Local Security Restriction Bypass Vulnerability
Release date:Updated on:
Affected Systems:Linux kernel 2.6.xDescription:--------------------------------------------------------------------------------Bugtraq id: 52742
Samba is a set of programs that implement the SMB (Server Messages Block) protocol, cross-platform file sharing and print sharing services.
Samba mount. cifs performs chdir on a specific directory before the fstab file is checked. cifs is installed as setuid, whic
into their blogs to install B.. In fact, I just read this book this evening, but now I have met it.
I would like to share with you the following content if you did not read this book to get started.
1.The following function is described in the book:
function sleep(milliSeconds) { var startTime = new Date().getTime(); while (new Date().getTime()
Where while (new date (). gettime ()
Only no operation is determined for the next loop.
2.Server. listen (1, 8888 ). to listen to the port,
Triangle
58%
10461
17953
2010-3-6
1012
Joseph
37%
10193
27231
2010-3-
1050
To the Max
51%
9773
18954
2010-3-6
1159
Palindrome
33%
9287
27778
2010-3-6
1207
The 3n + 1 problem
31%
8833
28000
2010-3-6
2027
No Brainer
69%
8821
12784
2010-3-6
1046
Color Me Less
47%
8524
17998
2010-3-
1664
P
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.